<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- 1. 给dom元素设置 一个ref属性 -->
      <input type="text" ref="xxx" />
    </div>

    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          list: [1, 2, 3],
        },
        beforeCreate() {
          console.log("创建前  ----->  ", this.list);
          // this.list = [1, 2, 3]
        },

        async created() {
          // 💥 发请求
          console.log("创建后  ----->  ", this.list);
        },
        beforeMount() {
          console.log("挂载前----->  ", this.$refs.xxx);
        },
        mounted() {
          // 💥 最先获取dom元素
          console.log(" 挂载后  ----->  ", this.$refs.xxx);
        },
        beforeUpdate() {
          console.log("更新前  ----->  ");
        },
        updated() {
          console.log("更新后  ----->  ");
        },
        beforeDestroy() {
          console.log("销毁前  ----->  ");
        },
        destroyed() {
          console.log("销毁后  ----->  ");
        },
      });
    </script>
  </body>
</html>
